<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:p="http://primefaces.org/ui">

	<ui:composition>
		<table id="imobiliaria-header" cellpadding="0" cellspacing="0">
			<tbody>
				<tr>
					<td valign="top">						
						<div class="titlebox" style="background-color: ##{searchImovelController.cliente.template.corBarra};">
							<table cellpadding="0" cellspacing="0" width="100%">
								<tr>
									<td width="25%" align="left">										
										<b><h:outputText value="#{msg['body.header.menu.creci']}" />:</b><p:spacer width="5px"/><h:outputText value="#{searchImovelController.cliente.CRECI}" />
									</td>
									<p:outputPanel rendered="#{searchImovelController.lancamentos == true}">
										<td align="center" width="60%">
											<b><h:outputText value="#{searchImovelController.cliente.endereco.municipio.nome}" /> - 
											<h:outputText value="#{searchImovelController.cliente.telefoneFixo}" /></b>
										</td>
										<td align="center" width="15%">
											<b><h:outputText value="#{msg['body.header.menu.lancamentos']}" /></b>
										</td>
									</p:outputPanel>
									
									<p:outputPanel rendered="#{searchImovelController.lancamentos == false}">
										<td align="center" width="75%">
											<b><h:outputText value="#{searchImovelController.cliente.endereco.municipio.nome}" /> - 
											<h:outputText value="#{searchImovelController.cliente.telefoneFixo}" /></b>
										</td>																				
									</p:outputPanel>
								</tr>
							</table>							
						</div>
					</td>					
				</tr>
				<tr>
					<td valign="middle">
						<h:form>
							<table id="content-header" cellpadding="0" cellspacing="0">
								<tr>
									<td width="30%" align="center">
										<table cellpadding="0" cellspacing="0" width="90%" height="160px" style="background-color: ##{searchImovelController.cliente.template.corFundoLogo};">
											<tr>
												<td align="center"><p:graphicImage value="#{searchImovelController.cliente.template.pathLogo}"/></td>
											</tr>
										</table>										
									</td>
									<p:outputPanel rendered="#{searchImovelController.cliente.template.corretor != null}">
										<td width="50%">
							
										</td>
										
										<td width="20%" align="left">									
											<p:graphicImage value="#{searchImovelController.cliente.template.pathCorretor}"/>																		
										</td>
									</p:outputPanel>
									<p:outputPanel rendered="#{searchImovelController.lancamentos == true}">
										<td width="5%">
											
										</td>
										
										<td width="65%" align="left" valign="middle">									
											<div class="lancamentobar" style="background-color: ##{searchImovelController.cliente.template.corFundoLancamento};">
												<p:dataGrid var="imovel" value="#{searchImovelController.topLancamentos}" paginator="false" columns="2">
													<p:column>
														<table cellpadding="0" cellspacing="0" class="top-lancamentos">
															<tr>
																<td width="45%" style="text-align: center;">
																	<p:commandLink oncomplete="lancamentoDialog.show()" update=":lancamento-panel"
																		actionListener="#{searchImovelController.loadImovelById}">
																		<f:param name="idImovel" value="#{imovel.id}" />																		
																		<p:graphicImage value="#{imovel.logoLancamento}" />
																	</p:commandLink>
																</td>
																<td width="55%" style="padding-left: 5px;">
																	<b><h:outputText value="#{msg['body.header.menu.cidade']}" />:</b><p:spacer width="3px;"/><h:outputText value="#{imovel.empresa.endereco.municipio.nome}" /><br/>
																	<b><h:outputText value="#{msg['body.header.menu.bairro']}" />:</b><p:spacer width="3px;"/><h:outputText value="#{imovel.empresa.endereco.bairro}" /><br/>
																	<b><h:outputText value="#{msg['body.header.menu.tipo']}" />:</b><p:spacer width="3px;"/><h:outputText value="#{imovel.subCategoria.categoria.nome}" /><br/>
																	<b><h:outputText value="#{msg['body.header.menu.dormitorios']}" />:</b><p:spacer width="3px;"/><h:outputText value="#{imovel.dormitorios}" /><br/>
																	<b><h:outputText value="#{msg['body.header.menu.opcao']}" />:</b><p:spacer width="3px;"/><h:outputText value="#{imovel.subCategoria.nome}" />
																</td>
															</tr>
														</table>
													</p:column>																										
												</p:dataGrid>
											</div>																	
										</td>
									</p:outputPanel>
									<p:outputPanel rendered="#{searchImovelController.lancamentos == false}">
										<p:outputPanel rendered="#{searchImovelController.cliente.template.corretor == null}">
											<td width="70%">
											
											</td>
										</p:outputPanel>																				
									</p:outputPanel>
								</tr>					
							</table>
						</h:form>	
					</td>
				</tr>
				<tr>
					<td>
						<h:form>
							<table width="100%" cellpadding="0" cellspacing="0">
								<tr>
									<td width="88%">
										<div class="menubar" style="background-color: ##{searchImovelController.cliente.template.corBarraMenu};"> 
											<table id="menu-header" cellpadding="0" cellspacing="0">
												<tr>
													<td width="16%">
														<p:graphicImage value="#{resource['images:icons/16x16/home.png']}"/><p:spacer width="5px" />
														<p:commandLink action="#{templateController.loadTemplate}" ajax="false" value="#{msg['body.header.menu.home']}" styleClass="template-menu-link">														
															<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
														</p:commandLink>
													</td>
													<td width="16%">
														<p:commandLink action="#{templateController.loadQuemSomos}" ajax="false" value="#{msg['body.header.menu.quemsomos']}" styleClass="template-menu-link">														
															<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
														</p:commandLink>
													</td>
													<td width="16%">
														<p:commandLink action="#{searchImovelController.loadImoveisVenda}" ajax="false" value="#{msg['body.header.menu.venda']}" styleClass="template-menu-link">														
															<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
														</p:commandLink>
													</td>
													<td width="16%">
														<p:commandLink action="#{searchImovelController.loadImoveisAluguel}" ajax="false" value="#{msg['body.header.menu.aluguel']}" styleClass="template-menu-link">														
															<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
														</p:commandLink>
													</td>													
													<td width="20%">
														<p:outputPanel rendered="#{searchImovelController.lancamentos == true}">
															<p:commandLink action="#{searchImovelController.loadLancamentos}" ajax="false" value="#{msg['body.header.menu.lancamentos']}" styleClass="template-menu-link">														
																<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
															</p:commandLink>
														</p:outputPanel>
													</td>
													<td width="16%">
														<p:commandLink action="#{templateController.loadLocalizacao}" ajax="false" value="#{msg['body.header.menu.localizacao']}" styleClass="template-menu-link">														
															<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
														</p:commandLink>
													</td>
												</tr>
											</table>
										</div>
									</td>
									<td width="12%" align="right">
										<div class="menubar-contato" style="background-color: ##{searchImovelController.cliente.template.corBarra};">
											<table id="menu-header" cellpadding="0" cellspacing="0">
												<tr>
													<td>
														<p:graphicImage value="#{resource['images:icons/16x16/mail.png']}"/><p:spacer width="5px" />
														<p:commandLink action="#{templateController.loadContato}" ajax="false" value="#{msg['body.header.menu.contato']}" styleClass="template-menu-link">														
															<f:param name="idCliente" value="#{searchImovelController.cliente.id}" />
														</p:commandLink>
													</td>							
												</tr>
											</table>
										</div>
									</td>
								</tr>
							</table>
						</h:form>
					</td>
				</tr>
			</tbody>
		</table>
		<p:dialog header="#{msg['body.header.menu.lancamentos.detalhes']}" widgetVar="lancamentoDialog" resizable="false" 
			modal="true" styleClass="dialog" showEffect="clip" position="top" width="520">        	
			<p:outputPanel id="lancamento-panel">
				<table cellpadding="0" cellspacing="0" width="100%">
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.codigo']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<b><h:outputText value="#{searchImovelController.imovel.id}" /></b>
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.titulo']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.pessoaJuridica.nome}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.tipo']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.tipoNegociacaoDesc}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.categoria']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.subCategoria.categoria.nome}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.dormitorios']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.dormitorios}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.suites']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.suites}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.banheiros']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.banheiros}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.garagens']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.garagens}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.areaUtil']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.areaUtil}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.preco']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{imovel.preco}">
								<f:convertNumber pattern = "#,###.00"/>
							</h:outputText>
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.descricao']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.descricao}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.rua']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.endereco.rua}" />,<h:outputText value="#{searchImovelController.imovel.empresa.endereco.numero}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.bairro']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.endereco.bairro}" />
						</td>
					</tr>
					<tr>
						<td class="lancamento-column-label">
							<b><h:outputText value="#{msg['body.header.lancamento.cidade']}" />:</b>
						</td>
						<td class="lancamento-column-value">
							<h:outputText value="#{searchImovelController.imovel.empresa.endereco.municipio.nome}" />/<h:outputText value="#{searchImovelController.imovel.empresa.endereco.municipio.estado.sigla}" />
						</td>
					</tr>					
					
				</table>		
				
				<p:spacer height="20px"/>
				<p:commandButton type="button" onclick="switcherLancamento.previous();" icon="ui-icon-circle-triangle-w" />  
				<p:spacer height="10px;" width="10px"/>
				<p:commandButton type="button" onclick="switcherLancamento.next();" icon="ui-icon-circle-triangle-e"/>  
				
				<p:separator style="width:100%;height:1px;" />
				
				<p:imageSwitch effect="wipe" widgetVar="switcherLancamento" slideshowAuto="false" style="display: block;margin-left: auto;margin-right: auto;">  
				    <ui:repeat value="#{searchImovelController.imovel.album}" var="image">  
				        <p:graphicImage value="#{image.originalImage}"/>  
				    </ui:repeat>  
				</p:imageSwitch> 
				
				
			</p:outputPanel>         	
		</p:dialog>
	</ui:composition>
</html>